package com.zy.springboot.entity.user;

import com.alibaba.fastjson.JSONObject;
import com.zy.springboot.entity.BaseEntity;
import org.springframework.boot.autoconfigure.domain.EntityScan;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * Created by y on 2019/1/11.
 */
@Entity
@Table(name = "T_SYS_USER", schema = "booksearch", catalog = "")
public class UserEntity extends BaseEntity implements Serializable {

    private String userName;//用户名
    private String password;//密码
    private Integer sex;//性别
    private String avatarUrl;//
    private String tel;//
    //
    private String city;
    private String province;
    private String country;
    private String nickName;
    private String openid;
    private String session_key;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }



    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getSession_key() {
        return session_key;
    }

    public void setSession_key(String session_key) {
        this.session_key = session_key;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    @Override
    public JSONObject getJSONObject() {
        JSONObject obj = new JSONObject();
        obj.put("ID", this.getId());
        obj.put("USERNAME", this.getUserName());
        obj.put("PASSWORD", this.getPassword());
        obj.put("SEX", this.getSex());
        obj.put("TEL", this.getTel());
        obj.put("CREATE_TIME", this.getCreateTime());
        obj.put("UPDATE_TIME", this.getUpdateTime());
        obj.put("DEL_FLAG",this.getDelFlag());
        obj.put("AVATARURL",this.getAvatarUrl());
        obj.put("CITY",this.getCity());
        obj.put("PROVINCE",this.getProvince());
        obj.put("COUNTRY",this.getCountry());
        obj.put("NICKNAME",this.getNickName());
        obj.put("OPENID",this.getOpenid());
        obj.put("SESSION_KEY",this.getSession_key());
        return obj;
    }

    @Override
    public String getTableName() {
        return "T_SYS_USER";
    }

    @Override
    public JSONObject getJSONColumns() {
        JSONObject obj = new JSONObject();
        obj.put("ID", "id");
        obj.put("USERNAME", "userName");
        obj.put("PASSWORD", "password");
        obj.put("SEX", "sex");
        obj.put("TEL", "tel");
        obj.put("CREATE_TIME", "createTime");
        obj.put("UPDATE_TIME", "updateTime");
        obj.put("DEL_FLAG","delFlag");
        obj.put("AVATARURL","avatarUrl");
        obj.put("CITY","city");
        obj.put("PROVINCE","province");
        obj.put("COUNTRY","country");
        obj.put("NICKNAME","nickName");
        obj.put("OPENID","openid");
        obj.put("SESSION_KEY","session_key");
        return obj;
    }

}

